package com.zyg.dao;

import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Constants;
import com.zyg.pojo.DeptEx;
import com.zyg.pojo.UserEx;
import org.apache.ibatis.annotations.*;

import java.util.List;

public interface UserExMapper extends BaseMapper<UserEx> {

    @Override
    @Select("select id,name,pass,birthday,dept_id from sys_user ${ew.customSqlSegment}")
    @Results({
            @Result(property = "id", column = "id"),
            @Result(property = "name", column = "name"),
            @Result(property = "pass", column = "pass"),
            @Result(property = "birthday", column = "birthday"),
            @Result(property = "dept", column = "dept_id", javaType = DeptEx.class,
                    one = @One(select = "com.zyg.dao.DeptExMapper.selectById"))
    })
    List<UserEx> selectList(IPage<UserEx> page, @Param(Constants.WRAPPER) Wrapper<UserEx> queryWrapper);

}
